#ifndef _STR_CONVERTER_H_
#define _STR_CONVERTER_H_

#include <string>

#ifndef IN
	#define IN
#endif

#ifndef OUT
	#define OUT
#endif

#ifndef DLL_API 
	#define DLL_API _declspec(dllimport)
#endif

//////////////////////////////////////////////////////////////////////////
/*
Interface 1: demo
char *aStr = "hello world!";
wchar_t *wStr = L"hello world!";
int unicodeLen;
int ansiLen;

unicodeLen = ANSI2Unicode(aStr, NULL);
wchar_t* pUnicode1 = new wchar_t[unicodeLen];
ANSI2Unicode(aStr, pUnicode1);
wcout<<pUnicode1<<endl;
delete[]pUnicode1;


ansiLen = Unicode2ANSI(wStr, NULL);
char *pAnsi1 = new char[ansiLen];
Unicode2ANSI(wStr, pAnsi1);
cout<<pAnsi1<<endl;
delete []pAnsi1;

unicodeLen = UTF82Unicode(aStr, NULL);
wchar_t* pUnicode2 = new wchar_t[unicodeLen];
ANSI2Unicode(aStr, pUnicode2);
wcout<<pUnicode2<<endl;
delete[]pUnicode2;


int utf8Len = Unicode2UTF8(wStr, NULL);
char *pUtf8 = new char[utf8Len];
Unicode2ANSI(wStr, pUtf8);
cout<<pUtf8<<endl;
delete []pUtf8;
*/
//////////////////////////////////////////////////////////////////////////
extern "C"
{

DLL_API int _stdcall ANSI2Unicode(IN const char* szAnsi, OUT wchar_t* szUnicode);
DLL_API int _stdcall Unicode2ANSI(IN const wchar_t* szUnicode, OUT char* szAnsi);
DLL_API int _stdcall UTF82Unicode(IN const char* szUtf8, OUT wchar_t* szUnicode );
DLL_API int _stdcall Unicode2UTF8( IN const wchar_t* szUnicode, OUT char *szUtf8 );
};


//////////////////////////////////////////////////////////////////////////
/*
interface 2: demo
wcout<<ANSI2Unicode("hello world!")<<endl;
cout<<Unicode2ANSI(L"hello world!")<<endl;
wcout<<UTF82Unicode("hello world!")<<endl;
cout<<Unicode2UTF8(L"hello world!")<<endl;
*/
//////////////////////////////////////////////////////////////////////////
DLL_API std::wstring _stdcall ANSI2Unicode(IN const std::string& strAnsi);
DLL_API std::string _stdcall Unicode2ANSI(IN const std::wstring& strUnicode);
DLL_API std::wstring _stdcall UTF82Unicode(IN const std::string& strUtf8);
DLL_API std::string _stdcall Unicode2UTF8(IN const std::wstring& strUnicode);

#endif